package cn.gson.fengboot.controller;

import cn.gson.fengboot.model.pojos.Zdelivery;
import cn.gson.fengboot.model.pojos.Zdeliverydelivery;
import cn.gson.fengboot.model.pojos.Zinvoice;
import cn.gson.fengboot.model.service.ZdeliveryService;
import cn.gson.fengboot.model.service.ZdeliverylogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/jf")
public class ZdeliveryController {
    @Autowired
    ZdeliveryService fpservice;

    //根据客户id查询交付计划
    @RequestMapping("/list_jh")
    @ResponseBody
    public Map<String,Object> kaipiao(Integer page, Integer size,String search,String search2,String search3){
        Page<Object> obj = PageHelper.startPage(page, size);
        fpservice.kaipiao(search,search2,search3);

        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",obj.getResult());
        return map;
    }

    //根据客户id查询交付计划
    @RequestMapping("/list_jhlb")
    @ResponseBody
    public Map<String,Object> jihua(Integer page, Integer size,String search,String search2){
        Page<Object> obj = PageHelper.startPage(page, size);
        fpservice.jihua(search,search2);

        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("rows",obj.getResult());
        return map;
    }

    //交付计划详情
    @RequestMapping("/list_jhxq")
    @ResponseBody
    public List<Zdeliverydelivery> kaipiao2(Integer search){
        return fpservice.kaipiao2(search);
    }

    //根据订单id查询交付计划
    @RequestMapping("/jihua_dindan")
    @ResponseBody
    public List<Zdelivery> juaofujihuadd(String search){
        return fpservice.juaofujihuadd(search);
    }

    //新增
    @RequestMapping("/add_fapiao")
    @ResponseBody
    public void addfapiao(@RequestBody Zdelivery jh){
        fpservice.add(jh);
    }

    //新增
    @RequestMapping("/sc")
    @ResponseBody
    public void sc(@RequestBody Zdelivery jh){
        fpservice.sc(jh);
    }

}
